package com.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dao.TeacherDao;
import com.mybatis.po.AppClass;
import com.mybatis.po.Student;
import com.mybatis.po.Teacher;

@Controller
public class TeacherController {
	@Autowired
	public TeacherDao teacherDao ;
	@RequestMapping("/selectTeacher")
	@ResponseBody
	public Map<String, List> selectTeacher(HttpServletRequest request) {
		Map<String,List> map = new HashMap<String, List>();
		List<Teacher>listTea = teacherDao.selectTeacher();
		if(listTea.size() !=0 ) {
			map.put("teacherList", listTea);
		}else {
			ArrayList <String>errorList = new ArrayList <String>();
			errorList.add("not Record");
			map.put("teacherList", errorList);
		}	
		return map;//返回map
	}
}
